package adavance.thread;

/**
 * @author oldliu
 * @since 1.0
 */
public class Worker extends Thread {
    public Worker(String nm){
        super(nm);
    }

    @Override
    public void run() {
        while (true){
            System.out.println("工人"+super.getName()+"干了1个小时的活");
            System.out.println("休息一会");
            try {
                sleep(1500);
                System.out.println("工人"+super.getName()+"睡到自然醒，继续干活");
            } catch (InterruptedException e) {
                System.out.println("工人"+super.getName()+"被喊醒了，继续干活");
                e.printStackTrace();
            }
        }
    }
}
